hysop.core.memory.allocator module

class hysop.core.memory.allocator.AllocatorBase(verbose, **kwds)[source]

Bases: TaggedObject

Base class for allocators.

Initialize a TaggedObject with a tag prefix/postfix/formatter, all optional.

__call__(size, alignment=None)[source]

Allocate nbytes aligned on min_alignment. If the first allocation fails, call the garbage collector and try again. It this fails a second time, raise a MemoryError.

abstract allocate(nbytes, verbose=True)[source]

Allocate nbytes bytes of memory. No minimal memory alignment is guaranteed. If allocation fails, this method has to raise a MemoryError.

allocate_aligned(size, alignment)[source]

Allocate size bytes aligned on alignment.

free(buf)[source]

Release the allocated buffer.

is_deferred = False
abstract is_on_host()[source]

Return true if buffers are allocated in host memory.

abstract max_alloc_size()[source]

Max allocatable size in bytes.

abstract prefix()[source]

Prefix for logs

try_release_blocks()[source]

Try to release memory blocks by calling the garbage collector.